package cn.gson.crm.controller.apply;

import cn.gson.crm.controller.BaseServlet;
import cn.gson.crm.model.dao.ApplyDao;
import cn.gson.crm.model.entity.Employee;
import cn.gson.crm.vo.CustomerVo;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class ApplyFormServlet
 */
@WebServlet("/apply/form")
public class ApplyFormServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
	public ApplyDao ad = new ApplyDao();

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		Employee e = (Employee) request.getSession().getAttribute("emp");
		List<CustomerVo> applyList = ad.getAllCustomer(e.getEmpId());
		request.setAttribute("applyList", applyList);
		forward("apply/apply_form.jsp");
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void post(HttpServletRequest request, HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
